package com.sidemenu.demo

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView

/**
 *  Created by zxn on 2025/8/28.
 **/

class ChatGroupBoardAdapter(private val itemList: List<BoardData>) :
    RecyclerView.Adapter<ChatGroupBoardAdapter.ViewHolder>() {

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
        val view = LayoutInflater.from(parent.context)
            .inflate(R.layout.item_chat_group_board, parent, false)
        return ViewHolder(view)
    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        val item = itemList[position]
        holder.tvTitle.text = item.title
//        holder.subtitleTextView.text = item.subtitle
//        holder.imageView.setImageResource(item.imageResource)

//        holder.itemView.setOnClickListener {
//            Toast.makeText(it.context, "点击了: ${item.title}", Toast.LENGTH_SHORT).show()
//        }
    }

    override fun getItemCount() = itemList.size

    class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
        val tvTitle: TextView = view.findViewById(R.id.tvTitle)
//        val subtitleTextView: TextView = view.findViewById(R.id.subtitleTextView)
    }
}